import pymysql
from pymysql import MySQLError

class Connect_Mysql:
    def __init__(self,database):
        self.database = database
    def connect_mysql(self):
        try:
         conn = pymysql.connect(host="192.168.110.200", port=13306,user="develop", password="bAvRZFXX", database=self.database)
         return conn
        except MySQLError as e:
         print(e)
         return None
    def select_mysql(self,sql,conn):
        conn=self.connect_mysql()
        cursor = conn.cursor()
        cursor.execute(sql)
        result = cursor.fetchall()
        cursor.close()
        return result

if __name__ == '__main__':
    cm=Connect_Mysql('df_test_database')
    result=cm.select_mysql("select * from df_goods_information",None)
    print(result)



